package rpc.frame.client.config;

import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import rpc.frame.core.provider.ServiceProvider;

import java.util.List;

@Configuration
public class BeanConfig {
    @Bean
    public LoadingCache<String, List<ServiceProvider>> buildCache(){
        return CacheBuilder.newBuilder().build(new CacheLoader<String,  List<ServiceProvider>>(){
            @Override
            public List<ServiceProvider> load(String s) throws Exception {
                //此处 初始化或者设置缓存
                return null;
            }
        } );
    }
}
